package com.xinpu.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinpu.vo.SalesOrederVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


@Repository
public interface SalesOrderMapper {
    @SqlParser(filter = true)
    IPage<SalesOrederVo> list(String salesName, String userName, String orderId, String start, String over, IPage<SalesOrederVo> page, String tenantId);

    @SqlParser(filter = true)
    @Select("SELECT\n" +
            "\tt_sales_order.order_id,\n" +
            "\tt_sales_order.price,\n" +
            "\tt_sales_order.img,\n" +
            "\tt_sales_order.id,\n" +
            "\tt_sales_order.create_time,\n" +
            "\tt_user.name  userName,\n" +
            "\tt_sales.name salesName\n" +
            "FROM\n" +
            "\tt_sales_order\n" +
            "\tLEFT JOIN t_user ON t_user.id = t_sales_order.uid\n" +
            "\tLEFT JOIN t_sales ON t_sales.id = t_sales_order.sid\n" +
            "WHERE t_sales_order.id=#{id}\n")
    SalesOrederVo findById(Integer id);

    @SqlParser(filter = true)
    IPage<SalesOrederVo> contract(Page<SalesOrederVo> page, String name);

}
